#include "Tool_PID.h"
#include "Tool_SetPara.h"
#include "Task_Move.h"
#include "Module_ESC.h"
#include "Tool_COMDebug.h"
/**
  * @brief  打印COMDebug可调用的函数名列表
  * @param  void
  * @retval void
  */
extern PID PitchPID,YawPID;

//void SetPitchPid(float m_Kp, float m_Ki, float m_Kd)
//{
//	PitchPID.SetPIDPara(m_Kp, m_Ki,m_Kd);
//	u1_printf("p:%f\ti:%f\td:%f\r\n",m_Kp,m_Ki,m_Kd);
//}

//void SetYawPid(float m_NB_PB, float m_NM_PM, float m_NS_PS,
//							 float m_NB_PB_kp, float m_NM_PM_kp, float m_NS_PS_kp,
//							 float m_NB_PB_kd, float m_NM_PM_kd, float m_NS_PS_kd )
//{
//	YawPID.Set_FUZZYPID(0,0,0,0,-8000, +8000, -500, +500, -5000, +5000,0,0,0,\
//									 m_NB_PB,m_NM_PM,m_NS_PS,\
//									 m_NB_PB_kp,m_NM_PM_kp,m_NS_PS_kp,\
//									 0.0f,0.0f,0.0f,\
//									 m_NB_PB_kd,m_NM_PM_kd,m_NS_PS_kd);
//	u1_printf("ok");
//}




	
void tips(float index)
{
	if(index<dev.fnum)
	{
		u1_printf("%s\r\n",dev.tab[(int)index].tips);
	}
	else		
	{
		u1_printf("index %f error\r\n",index);
	}
}


#include "Task_Shoot.h"

void Shoot()
{
	ShootOnce_Flag=1;
}

void ShtC()
{
	ShootConstant_Flag=1;//开了遥控器会强行清零
}



void SetPitch(float pos)
{
	PitchPID.SetTarget(PitchPID.Current+pos);
	u1_printf("pittar:%10.2f\r\n",PitchPID.Target);
}




void SetYaw(float pos)
{
	YawPID.SetTarget(YawPID.Current+pos);
	u1_printf("yawtar:%10.2f\r\n",YawPID.Target);
}



//给C语言编译的函数调用的接口
struct _m_nametab nametab[]=
{	
//	{(void*)SetYawPid,"SetYawPid","void SetYawPid(float m_NB_PB, float m_NM_PM, float m_NS_PS,float m_NB_PB_kp, float m_NM_PM_kp, float m_NS_PS_kp,float m_NB_PB_kd, float m_NM_PM_kd, float m_NS_PS_kd )"},
//	{(void *)ESCSetPara,"ESCSetPara","ESCSetPara(float _mESC_PWM_speed,float _mESC_PWM_volate)"},
//	{(void *)SetPara_DR,"SetPara_DR","SetPara_DR(float _DR_SPEED,float _PitchScale,float _YawScale,float CARFRAMEWEIGHT)"},
//	{(void *)SetPara_KM,"SetPara_KM","void SetPara_KM(SPEED1,SPEED2,PITCHWEIGHT,YAWWEIGHT1,YAWWEIGHT2,CARFRAMEWEIGHT)"},
//	{(void *)SetPara_Operater,"SetPara_Operater","SetPara_Operater(u8 mode)//0:P_Mid\t1:P_Up\t2:P_Down\t3:Y_Mid"},
//	{(void *)ParaSetting,"ParaSetting","ParaSetting(float _pFlag)//1:Start Setting\t2:Init Para\t3:Save Para"},
//	{(void*)GetParameter_User,"GetParameter_User",""},
//	{(void*)SetParameter_User,"SetParameter_User",""},
	{(void*)SetPitch,"SetPitch","void SetPitch(u32 pos)"},
	{(void*)SetYaw,"SetYaw","void SetYaw(u32 pos)"},
	{(void*)Shoot,"Shoot","void Shoot()"},
	{(void*)ShtC,"ShtC","void ShtC()"},
	{(void*)ESC_Toggle,"ESC_Toggle","void ESC_Toggle(void)"},
	{(void*)tips,"tips","void tips(float index)"},
	
};



struct _m_dev dev=
{
	nametab,
	sizeof(nametab)/sizeof(struct _m_nametab),//函数数量
	0,	  	//参数数量
	0,	 	//函数ID
};

